package com.xhd.db;

import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Vector;

import com.xhd.base.log.Log;
import com.xhd.base.log.LogFactory;
import com.xhd.base.util.xBaseObj;
import com.xhd.config.BizObjClass;
import com.xhd.exception.DatabaseException;
import com.xhd.exception.XException;
import com.xhd.server.ProcessHandle;
import com.xhd.server.ProcessHandleMgr;
import com.xhd.util.DataFormat;


	public class BizObjDaoImpl extends BizQueryImpl
	  implements BizObjDao
	{
	  private DBControls jm116 = null;
	  protected xBaseObj Creator = null;
	  private static final Log jm9;
	  static Class jm10;

	  static
	  {
	    Class tmp3_0 = jm10;
	    if (tmp3_0 == null)
	    {
	      
	      try
	      {
	       BizObjDaoImpl.jm10 = Class.forName("com.xhd.db.BizObjDaoImpl");
	      }
	      catch (ClassNotFoundException localClassNotFoundException)
	      {
	        throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
	      }
	    }
	    jm9 = LogFactory.getLog(tmp3_0);
	  }

	  protected BizObjDaoImpl(boolean paramBoolean)
	  {
	    super(paramBoolean);
	  }

	  protected void setDBControls(DBControls paramDBControls)
	  {
	    this.jm116 = paramDBControls;
	  }

	  private BizObjStore jm596(xBaseObj paramxBaseObj)
	    throws DatabaseException
	  {
	    if (paramxBaseObj.getSession() == null)
	    {
	      if (this.Creator == null)
	        throw new DatabaseException(30087);
	      paramxBaseObj.setSession(this.Creator.getSession());
	    }
	    BizObjStore localBizObjStore = new BizObjStore(paramxBaseObj);
	    XDBArea localCPCDBArea = XDBArea.getDBAreaObj(this.jm116.getValueId(), localBizObjStore.getTalbeName());
	    DBControl localDBControl = this.jm116.getByArea(localCPCDBArea.getName());
	    localBizObjStore.setDBControl(localDBControl, localCPCDBArea.getFields(localBizObjStore.getTalbeName(), localDBControl));
	    return localBizObjStore;
	  }

	  private String jm597(Object paramObject)
	  {
	    return BizObjClass.getInstance(paramObject.getClass()).getName();
	  }

	  protected DBControl getControl(String paramString) throws DatabaseException
	  {
	    return this.jm116.getByObj(paramString);
	  }

	  public int insert(xBaseObj paramxBaseObj)
	    throws DatabaseException
	  {
	    if (paramxBaseObj == null)
	      throw new DatabaseException(30041);
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    return localBizObjStore.insert();
	  }

	  public int insert(List paramList)
	    throws DatabaseException
	  {
	    if ((paramList == null) || (paramList.size() < 1))
	      return 0;
	    int i = 0;
	    BizObjStore localBizObjStore = jm596((xBaseObj)paramList.get(0));
	    for (int j = 0; j < paramList.size(); ++j)
	    {
	      localBizObjStore.setObject((xBaseObj)paramList.get(j));
	      i += localBizObjStore.insert();
	    }
	    return i;
	  }

	  public int insert(xBaseObj paramxBaseObj, List paramList)
	    throws DatabaseException
	  {
	    if ((paramxBaseObj == null) || (paramList == null) || (paramList.size() < 1))
	      return 0;
	    int i = 0;
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    for (int j = 0; j < paramList.size(); ++j)
	    {
	      localBizObjStore.setData(paramList.get(j));
	      i += localBizObjStore.insert();
	    }
	    return i;
	  }

	  public int insert(xBaseObj paramxBaseObj, List paramList, String paramString)
	    throws XException
	  {
	    if ((paramxBaseObj == null) || (paramList == null) || (paramList.size() < 1))
	      return 0;
	    int i = 0;
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    Hashtable localHashtable = null;
	    if (paramString != null)
	      localHashtable = paramxBaseObj.toHashtable(paramString);
	    for (int j = 0; j < paramList.size(); ++j)
	    {
	      if (localHashtable != null)
	      {
	        Map localMap = (Map)paramList.get(j);
	        localMap.putAll(localHashtable);
	        localBizObjStore.setData(localMap);
	      }
	      else
	      {
	        localBizObjStore.setData(paramList.get(j));
	      }
	      i += localBizObjStore.insert();
	    }
	    return i;
	  }

	  public int update(xBaseObj paramxBaseObj)
	    throws DatabaseException
	  {
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    return localBizObjStore.update(null, null, null);
	  }

	  public int updatePart(xBaseObj paramxBaseObj, List paramList)
	    throws DatabaseException
	  {
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    return localBizObjStore.update(null, paramList, null);
	  }

	  public int updatePart(xBaseObj paramxBaseObj, String paramString)
	    throws DatabaseException
	  {
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    return localBizObjStore.update(null, DataFormat.toVector(paramString), null);
	  }

	  public int updatePart(xBaseObj paramxBaseObj, String paramString, Object paramObject)
	    throws DatabaseException
	  {
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    DBWhereExp localDBWhereExp = null;
	    if (paramObject != null)
	      if (paramObject instanceof DBWhereExp)
	        localDBWhereExp = (DBWhereExp)paramObject;
	      else
	        localDBWhereExp = new DBWhereExp(paramObject.toString());
	    return localBizObjStore.update(localDBWhereExp, DataFormat.toVector(paramString), null);
	  }

	  public int updateFields(xBaseObj paramxBaseObj, List paramList)
	    throws DatabaseException
	  {
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    return localBizObjStore.update(null, null, paramList);
	  }

	  public int update(xBaseObj paramxBaseObj, Object paramObject)
	    throws DatabaseException
	  {
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    DBWhereExp localDBWhereExp = null;
	    if (paramObject != null)
	      if (paramObject instanceof DBWhereExp)
	        localDBWhereExp = (DBWhereExp)paramObject;
	      else
	        localDBWhereExp = new DBWhereExp(paramObject.toString());
	    return localBizObjStore.update(localDBWhereExp, null, null);
	  }

	  public int updatePart(xBaseObj paramxBaseObj, List paramList, Object paramObject)
	    throws DatabaseException
	  {
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    DBWhereExp localDBWhereExp = null;
	    if (paramObject != null)
	      if (paramObject instanceof DBWhereExp)
	        localDBWhereExp = (DBWhereExp)paramObject;
	      else
	        localDBWhereExp = new DBWhereExp(paramObject.toString());
	    return localBizObjStore.update(localDBWhereExp, paramList, null);
	  }

	  public int updateFields(xBaseObj paramxBaseObj, List paramList, Object paramObject)
	    throws DatabaseException
	  {
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    DBWhereExp localDBWhereExp = null;
	    if (paramObject != null)
	      if (paramObject instanceof DBWhereExp)
	        localDBWhereExp = (DBWhereExp)paramObject;
	      else
	        localDBWhereExp = new DBWhereExp(paramObject.toString());
	    return localBizObjStore.update(localDBWhereExp, null, paramList);
	  }

	  public int delete(xBaseObj paramxBaseObj)
	    throws DatabaseException
	  {
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    return localBizObjStore.delete(null);
	  }

	  public int delete(xBaseObj paramxBaseObj, Object paramObject)
	    throws DatabaseException
	  {
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    DBWhereExp localDBWhereExp = null;
	    if (paramObject != null)
	      if (paramObject instanceof DBWhereExp)
	        localDBWhereExp = (DBWhereExp)paramObject;
	      else
	        localDBWhereExp = new DBWhereExp(paramObject.toString());
	    return localBizObjStore.delete(localDBWhereExp);
	  }

	  public int delete(String paramString, Object paramObject)
	    throws DatabaseException
	  {
	    xBaseObj localxBaseObj = null;
	    try
	    {
	      BizObjClass localBizObjClass = BizObjClass.getInstance(paramString);
	      if (localBizObjClass != null)
	        localxBaseObj = (xBaseObj)localBizObjClass.getBizClass().newInstance();
	    }
	    catch (Exception localException)
	    {
	      jm9.error(localException);
	      throw new DatabaseException(30086, paramString, localException.getMessage());
	    }
	    DBWhereExp localDBWhereExp = null;
	    if (paramObject != null)
	      if (paramObject instanceof DBWhereExp)
	        localDBWhereExp = (DBWhereExp)paramObject;
	      else
	        localDBWhereExp = new DBWhereExp(paramObject.toString());
	    if (localxBaseObj != null)
	    {
	    	BizObjStore  localObject = jm596(localxBaseObj);
	      return ((BizObjStore)localObject).delete(localDBWhereExp);
	    }
	    Object localObject = this.jm116.getByObj(paramString);
	    DBSQL localDBSQL = new DBSQL();
	    localDBSQL.append("DELETE FROM ");
	    localDBSQL.append(paramString);
	    localDBSQL.append(" WHERE ");
	    localDBSQL.append(((DBControl)localObject).getDBType(), localDBWhereExp);
	    return ((DBControl)localObject).execute(localDBSQL);
	  }

	  public void select(xBaseObj paramxBaseObj)
	    throws DatabaseException
	  {
	    select(paramxBaseObj, null);
	  }

	  public void select(xBaseObj paramxBaseObj, Object paramObject)
	    throws DatabaseException
	  {
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    DBWhereExp localDBWhereExp = null;
	    if (paramObject != null)
	      if (paramObject instanceof DBWhereExp)
	        localDBWhereExp = (DBWhereExp)paramObject;
	      else
	        localDBWhereExp = new DBWhereExp(paramObject.toString());
	    if (localBizObjStore.select(localDBWhereExp))
	      return;
	    if (localDBWhereExp == null)
	      throw new DatabaseException(30049);
	    throw new DatabaseException(30049, localDBWhereExp.toSQL(localBizObjStore.getDBType()));
	  }

	  public Object getById(Class paramClass, int paramInt)
	    throws DatabaseException
	  {
	    xBaseObj localxBaseObj = null;
	    try
	    {
	      localxBaseObj = (xBaseObj)paramClass.newInstance();
	    }
	    catch (Exception localException)
	    {
	      jm9.error(localException);
	      throw new DatabaseException(30086, paramClass.getName(), localException.getMessage());
	    }
	    BizObjStore localBizObjStore = jm596(localxBaseObj);
	    BizObjPK localBizObjPK = BizObjPK.getDBObjPK(localxBaseObj);
	    if (localBizObjStore.select(DBWhereExp.eq(localBizObjPK.getPKField(), paramInt)))
	      return localxBaseObj;
	    return null;
	  }

	  public Vector search(xBaseObj paramxBaseObj, Object paramObject, int paramInt)
	    throws DatabaseException
	  {
	    DBWhereExp localDBWhereExp = null;
	    if (paramObject != null)
	      if (paramObject instanceof DBWhereExp)
	        localDBWhereExp = (DBWhereExp)paramObject;
	      else
	        localDBWhereExp = new DBWhereExp(paramObject.toString());
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    return localBizObjStore.search(null, localDBWhereExp, paramInt);
	  }

	  public Vector search(xBaseObj paramxBaseObj, String paramString, Object paramObject, int paramInt)
	    throws DatabaseException
	  {
	    DBWhereExp localDBWhereExp = null;
	    if (paramObject != null)
	      if (paramObject instanceof DBWhereExp)
	        localDBWhereExp = (DBWhereExp)paramObject;
	      else
	        localDBWhereExp = new DBWhereExp(paramObject.toString());
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    return localBizObjStore.search(paramString, localDBWhereExp, paramInt);
	  }

	  public int getObjId(xBaseObj paramxBaseObj, Object paramObject)
	    throws DatabaseException
	  {
	    String str = jm597(paramxBaseObj);
	    BizObjPK localBizObjPK = BizObjPK.getDBObjPK(paramxBaseObj);
	    DBControl localDBControl = this.jm116.getByObj(str);
	    DBSQL localDBSQL = new DBSQL();
	    localDBSQL.append("SELECT ");
	    localDBSQL.append(localBizObjPK.getPKField());
	    localDBSQL.append(" FROM ");
	    localDBSQL.append(str);
	    if (paramObject != null)
	    {
	      localDBSQL.append(" WHERE ");
	      if (paramObject instanceof DBWhereExp)
	        localDBSQL.append(localDBControl.getDBType(), (DBWhereExp)paramObject);
	      else
	        localDBSQL.append(paramObject.toString());
	    }
	    return localDBControl.intSelect(localDBSQL);
	  }

	  public int getCount(xBaseObj paramxBaseObj, Object paramObject)
	    throws DatabaseException
	  {
	    DBWhereExp localDBWhereExp = null;
	    if (paramObject != null)
	      if (paramObject instanceof DBWhereExp)
	        localDBWhereExp = (DBWhereExp)paramObject;
	      else
	        localDBWhereExp = new DBWhereExp(paramObject.toString());
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    return localBizObjStore.getCount(localDBWhereExp);
	  }

	  public boolean exists(xBaseObj paramxBaseObj)
	    throws DatabaseException
	  {
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    return localBizObjStore.checkExists(new DBWhereExp(BizObjPK.getDBObjPK(paramxBaseObj).getSQLWhere(paramxBaseObj)));
	  }

	  public boolean exists(xBaseObj paramxBaseObj, Object paramObject)
	    throws DatabaseException
	  {
	    DBWhereExp localDBWhereExp = null;
	    if (paramObject != null)
	      if (paramObject instanceof DBWhereExp)
	        localDBWhereExp = (DBWhereExp)paramObject;
	      else
	        localDBWhereExp = new DBWhereExp(paramObject.toString());
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    return localBizObjStore.checkExists(localDBWhereExp);
	  }

	  public int IDGenerator(xBaseObj paramxBaseObj)
	    throws DatabaseException
	  {
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    XDBArea localCPCDBArea = XDBArea.getDBAreaObj(this.jm116.getValueId(), "cpcidlist");
	    DBControl localDBControl = new DBControl(DBConfig.getConfig(this.jm116.getValueId(), localCPCDBArea.getName()));
	    return localBizObjStore.genId(localDBControl, null);
	  }

	  public int IDGenerator(xBaseObj paramxBaseObj, String paramString)
	    throws DatabaseException
	  {
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    XDBArea localXDBArea = XDBArea.getDBAreaObj(this.jm116.getValueId(), "cpcidlist");
	    DBControl localDBControl = new DBControl(DBConfig.getConfig(this.jm116.getValueId(), localXDBArea.getName()));
	    return localBizObjStore.genId(localDBControl, paramString);
	  }

	  public int genBuiltInId(xBaseObj paramxBaseObj)
	    throws DatabaseException
	  {
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    XDBArea localXDBArea = XDBArea.getDBAreaObj(this.jm116.getValueId(), "cpcidlist");
	    DBControl localDBControl = new DBControl(DBConfig.getConfig(this.jm116.getValueId(), localXDBArea.getName()));
	    return localBizObjStore.genBuildInId(localDBControl, null);
	  }

	  public int IDGenerator(String paramString1, String paramString2)
	    throws DatabaseException
	  {
	    if (paramString1 == null)
	      throw new DatabaseException(30041);
	    DBConn localDBConn = null;
	    try
	    {
	      String str = XDBArea.getDBArea(this.jm116.getValueId(), "cpcidlist");
	      DBControl localDBControl = new DBControl(DBConfig.getConfig(this.jm116.getValueId(), str));
	      localDBConn = localDBControl.getConn();
	      localDBConn.setTransation(true);
	      int i = localDBControl.IDGenerator(getControl(paramString1), paramString1, paramString2, false);
	      localDBConn.commit();
	      int j = i;
	      return j;
	    }
	    catch (DatabaseException localDatabaseException)
	    {
	      if (localDBConn != null)
	        localDBConn.rollback();
	      throw localDatabaseException;
	    }
	    finally
	    {
	      if (localDBConn != null)
	        localDBConn.close();
	    }
	  }

	  public int IDGenerator(xBaseObj paramxBaseObj, String paramString, Object paramObject)
	    throws DatabaseException
	  {
	    if (paramObject == null)
	      return IDGenerator(paramxBaseObj, paramString);
	    String str1 = BizObjClass.getObjName(paramxBaseObj);
	    DBControl localDBControl = getControl(str1);
	    String str2 = null;
	    if (paramObject instanceof DBWhereExp)
	      str2 = ((DBWhereExp)paramObject).toSQL(localDBControl.getDBType());
	    else
	      str2 = paramObject.toString();
	    return localDBControl.IDGenerator(str1, paramString, str2);
	  }

	  public int IDGenerator(String paramString1, String paramString2, String paramString3)
	    throws DatabaseException
	  {
	    if (paramString1 == null)
	      throw new DatabaseException(30041);
	    DBControl localDBControl = getControl(paramString1);
	    return localDBControl.IDGenerator(paramString1, paramString2, paramString3);
	  }

	  public void instanceObject(xBaseObj paramxBaseObj)
	    throws DatabaseException
	  {
	    select(paramxBaseObj, null);
	  }

	  public void instanceObject(xBaseObj paramxBaseObj, Object paramObject)
	    throws DatabaseException
	  {
	    select(paramxBaseObj, paramObject);
	  }

	  public int deleteSubObj(xBaseObj paramxBaseObj, String paramString)
	    throws DatabaseException
	  {
	    if ((paramxBaseObj == null) || (paramString == null))
	      throw new DatabaseException(30041);
	    return delete(paramString, BizObjPK.getDBObjPK(paramxBaseObj).getSQLWhere(paramxBaseObj));
	  }

	  public int updateObj(xBaseObj paramxBaseObj)
	    throws DatabaseException
	  {
	    return update(paramxBaseObj);
	  }

	  public int updateObj(xBaseObj paramxBaseObj, String paramString)
	    throws DatabaseException
	  {
	    return updatePart(paramxBaseObj, DataFormat.toVector(paramString));
	  }

	  public int update(xBaseObj paramxBaseObj, Object paramObject, String paramString)
	    throws DatabaseException
	  {
	    return updatePart(paramxBaseObj, DataFormat.toVector(paramString), paramObject);
	  }

	  public int IDGenerator(xBaseObj paramxBaseObj, String paramString, boolean paramBoolean)
	    throws DatabaseException
	  {
	    if (paramBoolean)
	      return genBuiltInId(paramxBaseObj);
	    return IDGenerator(paramxBaseObj, paramString);
	  }

	  public int updateFields(xBaseObj paramxBaseObj, String paramString)
	    throws DatabaseException
	  {
	    return updateFields(paramxBaseObj, DataFormat.toVector(paramString));
	  }

	  public int updateFields(xBaseObj paramxBaseObj, String paramString, Object paramObject)
	    throws DatabaseException
	  {
	    return updateFields(paramxBaseObj, DataFormat.toVector(paramString), paramObject);
	  }

	  public int updateFields(xBaseObj paramxBaseObj, String paramString1, String paramString2, Object paramObject)
	    throws DatabaseException
	  {
	    BizObjStore localBizObjStore = jm596(paramxBaseObj);
	    DBWhereExp localDBWhereExp = null;
	    if (paramObject != null)
	      if (paramObject instanceof DBWhereExp)
	        localDBWhereExp = (DBWhereExp)paramObject;
	      else
	        localDBWhereExp = new DBWhereExp(paramObject.toString());
	    return localBizObjStore.update(localDBWhereExp, DataFormat.toVector(paramString2), DataFormat.toVector(paramString1));
	  }

	  protected xBaseObj getCreator()
	  {
	    if (this.Creator == null)
	    {
	      ProcessHandle localProcessHandle = ProcessHandleMgr.getHandle();
	      if (localProcessHandle != null)
	        this.Creator = localProcessHandle.getBizObj();
	    }
	    return this.Creator;
	  }

	  public int existsObj(xBaseObj paramxBaseObj, String paramString)
	    throws DatabaseException
	  {
	    return getCount(paramxBaseObj, DBWhereExp.eq(paramxBaseObj, paramString, true));
	  }

	  public int existsObj(xBaseObj paramxBaseObj)
	    throws DatabaseException
	  {
	    return getCount(paramxBaseObj, new DBWhereExp(BizObjPK.getDBObjPK(paramxBaseObj).getSQLWhere(paramxBaseObj)));
	  }

	  public int insert(String paramString, Map paramMap)
	    throws DatabaseException
	  {
	    if ((paramString == null) || (paramMap == null))
	      throw new DatabaseException(30041, paramString);
	    XDBArea localXDBArea = XDBArea.getDBAreaObj(this.jm116.getValueId(), paramString);
	    DBControl localDBControl = this.jm116.getByArea(localXDBArea.getName());
	    BizObjFields localBizObjFields = localXDBArea.getFields(paramString, localDBControl);
	    if ((localBizObjFields == null) || (localBizObjFields.size() < 1))
	      return 0;
	    DBSQL localDBSQL = new DBSQL();
	    StringBuffer localStringBuffer = new StringBuffer(256);
	    localDBSQL.append("INSERT INTO ");
	    localDBSQL.append(paramString);
	    localDBSQL.append("(");
	    localStringBuffer.append(") VALUES(");
	    Iterator localIterator = localBizObjFields.fieldSet().iterator();
	    int i = 1;
	    while (localIterator.hasNext())
	    {
	      String str = (String)localIterator.next();
	      int j = localBizObjFields.getJdbcType(str);
	      if (i == 0)
	      {
	        localDBSQL.append(",");
	        localStringBuffer.append(',');
	      }
	      else
	      {
	        i = 0;
	      }
	      localDBSQL.append(str);
	      localStringBuffer.append('?');
	      localDBSQL.addParam(j, (String)paramMap.get(str));
	    }
	    if (i != 0)
	      return 0;
	    localStringBuffer.append(')');
	    localDBSQL.append(localStringBuffer.toString());
	    return localDBControl.execute(localDBSQL);
	  }

	  public int update(String paramString, Map paramMap, DBWhereExp paramDBWhereExp)
	    throws DatabaseException
	  {
	    if ((paramString == null) || (paramMap == null) || (paramDBWhereExp == null))
	      throw new DatabaseException(30041, paramString);
	    XDBArea localXDBArea = XDBArea.getDBAreaObj(this.jm116.getValueId(), paramString);
	    DBControl localDBControl = this.jm116.getByArea(localXDBArea.getName());
	    BizObjFields localBizObjFields = localXDBArea.getFields(paramString, localDBControl);
	    if ((localBizObjFields == null) || (localBizObjFields.size() < 1))
	      return 0;
	    DBSQL localDBSQL = new DBSQL();
	    localDBSQL.append("UPDATE ");
	    localDBSQL.append(paramString);
	    localDBSQL.append(" SET ");
	    int i = localDBControl.getDBType();
	    int j = 1;
	    Iterator localIterator = localBizObjFields.fieldSet().iterator();
	    while (localIterator.hasNext())
	    {
	      String str = (String)localIterator.next();
	      if (!(paramMap.containsKey(str)))
	        continue;
	      if (j == 0)
	        localDBSQL.append(",");
	      else
	        j = 0;
	      int k = localBizObjFields.getJdbcType(str);
	      localDBSQL.append(str);
	      localDBSQL.append("=?");
	      localDBSQL.addParam(k, (String)paramMap.get(str));
	    }
	    if (j != 0)
	      return 0;
	    localDBSQL.append(" WHERE ");
	    localDBSQL.append(i, paramDBWhereExp);
	    return localDBControl.execute(localDBSQL);
	  }

	  public int getSequence(String paramString)
	    throws DatabaseException
	  {
	    try
	    {
	      DBControl localDBControl = this.jm116.getByObj(null);
	      StringBuffer localStringBuffer = new StringBuffer(64);
	      localStringBuffer.append("Select ");
	      localStringBuffer.append(paramString);
	      localStringBuffer.append(".NextVal");
	      localStringBuffer.append(" From Dual");
	      return localDBControl.intSelect(localStringBuffer.toString());
	    }
	    catch (DatabaseException localDatabaseException)
	    {
	      throw localDatabaseException;
	    }
	  }
}
